package servicesImp.business;

import base.IBaseMapperWithoutBLOBs;
import base.IBaseServicesWithoutBLOBsImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import services.business.BusinessInfoServices;
import services.business.CompanyAssessServices;
import wt.dao.business.CompanyAssessMapper;
import wt.entity.business.BusinessInfo;
import wt.entity.business.CompanyAssess;
import wt.entity.business.CompanyAssessExample;
import wt.staticData.ShortData;
import wt.staticData.TableName;

import java.util.Date;

/**
 * Created by Administrator on 2017/10/14.
 */
@Service
public class CompanyAssessServicesImp extends IBaseServicesWithoutBLOBsImpl< CompanyAssess,CompanyAssessExample> implements CompanyAssessServices {
    @Autowired
    CompanyAssessMapper companyAssessMapper;
    @Autowired
    BusinessInfoServices businessInfoServices;
    @Override
    public IBaseMapperWithoutBLOBs<CompanyAssess, CompanyAssessExample>getMapper() {
        return this.companyAssessMapper;
    }

    @Override
    public String getTableName() {
        return TableName.BUS_COMPANY_ASSESS;
    }


    @Transactional
    public void insertSelective(CompanyAssess companyAssess, String businessId) throws Exception {
        BusinessInfo businessInfo = new BusinessInfo();
        businessInfo.setId(businessId);
        businessInfo.setCompanyIsAssess(ShortData.s1);
        businessInfo.setCompanyAssessTime(new Date());
        businessInfoServices.updateByPrimaryKeySelective(businessInfo);
        companyAssess.setBusinessId(businessId);
        getCurrentProxy().insertSelective(companyAssess);
    }
}
